{% for num in range(index|int, count|int, 1) %}

---

apiVersion: v1
kind: Namespace
metadata:
  name: namespace{{ num }}

---

apiVersion: v1
kind: ConfigMap
metadata:
  name: f5-vxlan-test-c{{ num }}
  namespace: namespace{{ num }}
  labels:
    f5type: virtual-server
    as3: "true"
data:
  template: |
     {
        "class": "AS3",
        "action": "deploy",
        "persist": true,
        "declaration": {
            "class": "ADC",
            "schemaVersion": "3.18.0",
            "id": "veconfig-nsgroup1",
            "namespace{{ num }}": {
                "class": "Tenant",
                "service_name_app{{ num }}": {
                    "class": "Application",
                    "template": "generic",
                    "service_name_vs{{ num }}": {
                        "class": "Service_TCP",
                        "virtualAddresses": [
                            "197.14.222.{{ num }}"
                        ],
                        "virtualPort": {{ num + 8000 }},
                        "profileFTP":  {
                            "use": "service_name_ftpprofile{{ num }}"
                        },
                        "snat": "self",
                        "pool": "service_name_pool{{ num }}"
                    },
                    "service_name_pool{{ num }}": {
                        "class": "Pool",
                        "monitors": [
                            "tcp"
                        ],
                        "loadBalancingMode": "least-connections-member",
                        "members": [
                            {
                                "servicePort": 80,
                                "serverAddresses": []
                            }
                        ]
                    },
                    "service_name_ftpprofile{{ num }}": {
                        "class": "FTP_Profile",
                        "remark": "description",
                        "port": 300,
                        "ftpsMode": "allow",
                        "enforceTlsSessionReuseEnabled": true,
                        "activeModeEnabled": false,
                        "securityEnabled": true,
                        "translateExtendedEnabled": false,
                        "inheritParentProfileEnabled": true
                    }
                }
            }
        }
      }

---

apiVersion: v1
kind: Service
metadata:
  name: f5-vxlan-test-s{{ num }}
  namespace: namespace{{ num }}
  labels:
    cis.f5.com/as3-tenant: namespace{{ num }}
    cis.f5.com/as3-app: service_name_app{{ num }}
    cis.f5.com/as3-pool: service_name_pool{{ num }}
spec:
  ports:
  - port: {{ num + 8000 }}
    protocol: TCP
    targetPort: 80
  selector:
    run: f5-vxlan-test-d{{ num }}
  sessionAffinity: None
  type: ClusterIP


---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: f5-vxlan-test-d{{ num }}
  namespace: namespace{{ num }}
spec:
  replicas: 1
  selector:
    matchLabels:
      run: f5-vxlan-test-d{{ num }}
  template:
    metadata:
      labels:
        run: f5-vxlan-test-d{{ num }}
    spec:
      containers:
      - image: "nginx:latest"
        imagePullPolicy: IfNotPresent
        name: f5-vxlan-test-d{{ num }}
        ports:
        - containerPort: 80
          protocol: TCP



{% endfor %}
